package com.starinside.wp.repository;

import com.starinside.wp.domain.WorkDate;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.Date;

/**
 * *******************************
 * Created by Tim.
 * form com.matt
 * on 2017/7/21
 * *******************************
 */
public interface WorkDateRepository extends JpaRepository<WorkDate, String> {

    WorkDate findByWorkDate(Date workDate);

    @Query(value = "SELECT COUNT(id) FROM work_date WHERE workDate >= :beginDate  and  workDate <= :endDate", nativeQuery = true)
    Integer findByWorkDateDay(@Param("beginDate")Date beginDate, @Param("endDate") Date endDate);
}
